package com.example.mockito;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.provider.NullSource;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

public class NewAnnotations {
}

class ArticleManagerTest extends SampleBaseTestCase {

//    @Mock
//    private ArticleCalculator calculator;
//    @Mock(name = "database")
//    private ArticleDatabase dbMock; // note the mock name attribute
//
//    @Spy
//    private UserProvider userProvider = spy(new ConsumerUserProvider());
//
//    @InjectMocks
//    private ArticleManager manager;
//
//    @Test
//    public void shouldDoSomething() {
//        manager.initiateArticle();
//        userProvider.provider();
//
//        dbMock.addListener(any(ArticleListener.class));
//        verify(userProvider).provider(any(ArticleListener.class));
//        verify(dbMock).addListener(any(ArticleListener.class));
//    }
//
//    private class ArticleCalculator {
//
//    }


}

class SampleBaseTestCase {
    @BeforeEach
    public void initMocks() {
        MockitoAnnotations.initMocks(this);
    }
}

class ArticleDatabase {

    public void addListener(ArticleListener articleListener) {

    }
}

interface UserProvider {

    String provider();
}

class ConsumerUserProvider implements UserProvider {
    @Override
    public String provider() {
        return "test";
    }
}

class ArticleManager {

    public void initiateArticle() {

    }
}

class ArticleListener {
}